---
layout: default
---

<div class="page clearfix" index>
    <div class="left">
        <h1>欢迎访问我的博客</h1>
        <small>这是我的网上小屋</small>
        <hr>
        <ul>
          {% for post in paginator.posts %}
            <li>
              <div class="flex">
                <div class="postdate">
                  <p class="days">{{ post.date | date: "%m-%d" }}</p>
                  <p class="year">{{ post.date | date: "%Y" }}</p>
                </div>

                <div style="flex: 1">
                  <h2>
                    <a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
                  </h2>

                  <div class="excerpt">
                    {{ post.excerpt | strip_html }}
                  </div>

                  <div class="flex">
                    <div class="label" style="flex: 1">
                      <div class="label-card">
                          {% if post.author %}
                            <i class="fa fa-user"></i>{{ post.author }}
                          {% endif %}
                      </div>
                  
                      <div class="label-card">
                        {% include category.html %}
                      </div>
    
                      <div class="label-card">
                        {% include tag.html %}
                      </div>
                    </div>
                  
                    <div class="read-all">
                      <a  href="{{ post.url | prepend: site.baseurl }}"><i class="fa fa-newspaper-o"></i>阅读全部</a>
                    </div>
                  </div>
                </div>
              </div>
              <hr>
            </li>
          {% endfor %}
        </ul>

        <!-- Pagination links -->
        <div class="pagination">
          <ul>
            {% if paginator.previous_page %}
              <li><a href="/index.html" class="prev">首页</a></li>
            {% else %}
              <li><span class="prev disable">首页</span></li>
            {% endif %}

            <!--span class="page_number ">{{ paginator.page }}/{{ paginator.total_pages }}</span-->

            {% for page in (1..paginator.total_pages) %}
              {% if page == paginator.page %}
                <li><span class="nums disable">{{ page }}</span></li>
              {% elsif page == 1 %}
                <li><a class="nums" href="{{ '/index.html' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a></li>
              {% else %}
                <li><a class="nums" href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a></li>
              {% endif %}
            {% endfor %}

            {% if paginator.next_page %}
              <li><a href="/page{{ paginator.total_pages }}" class="next">末页</a></li>
            {% else %}
              <li><span class="next disable">末页</span></li>
            {% endif %}
          </ul>
        </div>
      </div>
    <!-- <button class="anchor"><i class="fa fa-anchor"></i></button> -->
    <div class="right">
        <div class="wrap">
            <div class="side">
                <div>
                    <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
                    最近发布
                </div>
                <ul class="content-ul" recent>
                    {% for post in site.posts offset: 0 limit: 10  %}
                        <li><a href="{{ post.url }}">{{ post.title }}</a></li>
                    {% endfor %}
                </ul>
            </div>

            <!-- Content -->
            <div class="side ">
                <div>
                    <i class="fa fa-th-list"></i>
                    分类
                </div>
                <ul class="content-ul" cate>
                    {% for category in site.categories order:ascending %}
                    <li>
                        <a href="{{ root_url }}/{{ site.category_dir }}#{{ category | first }}" class="categories-list-item" cate="{{ category | first }}">
                            <span class="name">
                                {{ category | first }}
                            </span>
                            <span class="badge">{{ category | last | size }}</span>
                        </a>
                    </li>
                    {% endfor %}
                </ul>
            </div>
            <!-- 其他div框放到这里 -->
            <div class="side">
                <div>
                    <i class="fa fa-tags"></i>
                    标签
                </div>
                <div class="tags-cloud">
                    {% assign first = site.tags.first %}
                    {% assign max = first[1].size %}
                    {% assign min = max %}
                    {% for tag in site.tags offset:1 %}
                      {% if tag[1].size > max %}
                        {% assign max = tag[1].size %}
                      {% elsif tag[1].size < min %}
                        {% assign min = tag[1].size %}
                      {% endif %}
                    {% endfor %}

                    {% if max == min %}
                        {% assign diff = 1 %}
                    {% else %}    
                        {% assign diff = max | minus: min %}
                    {% endif %}

                    {% for tag in site.tags %}
                      {% assign temp = tag[1].size | minus: min | times: 36 | divided_by: diff %}
                      {% assign base = temp | divided_by: 4 %}
                      {% assign remain = temp | modulo: 4 %}
                      {% if remain == 0 %}
                        {% assign size = base | plus: 9 %}
                      {% elsif remain == 1 or remain == 2 %}
                        {% assign size = base | plus: 9 | append: '.5' %}
                      {% else %}
                        {% assign size = base | plus: 10 %}
                      {% endif %}
                      {% if remain == 0 or remain == 1 %}
                        {% assign color = 9 | minus: base %}
                      {% else %}
                        {% assign color = 8 | minus: base %}
                      {% endif %}
                      <a href="{{ root_url }}/{{ site.tag_dir }}#{{ tag[0] }}" style="font-size: {{ size }}pt; color: #{{ color }}{{ color }}{{ color }};">{{ tag[0] }}</a>
                    {% endfor %}
                </div>
            </div>

            <!-- <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    Links
                </div>
                <ul  class="content-ul">

                </ul>
            </div> -->
        </div>
    </div>
</div>
